#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/wait.h>
int main()
{
  pid_t id=fork();
  if(id==0)
  {//child
    printf("command begin...\n");
    char* argv[]={"ls","-a","-l", "-i", NULL};//必须以NULL结尾 };
    // execv("/usr/bin/ls",argv);
    //execl("/usr/bin/ls","ls","-a","-l","-i",NULL);
    //execlp("ls","ls","-a","-l","-d",NULL); //直接上传文件名即可
    execvp("ls",argv);
    printf("command end...\n");//这里是否会打印呢？
    exit(1);
  }
  //father
  waitpid(-1,NULL,0);//等待任意一个子进程
  printf("father wait success!\n");
  return 0;
}
